<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../../../resources/js-test.js"></script>
</head>
<body onload="test()">
<p>This test checks that the context menu is shown on a two finger tap gesture.</p>
<div id="text">Testing</div>
<div id="result">FAIL</div>
<div id="eventSequence">Event sequence:</div>
<script>
"use strict";

function test()
{
    if (window.testRunner)
        testRunner.dumpAsText();

    document.oncontextmenu = function() {
        document.getElementById("result").innerHTML = "PASS (ContextMenu event seen)";
    }

    for (let evtType of ["contextmenu", "mouseover", "mousemove", "mouseout",
            "mouseenter", "mouseleave", "mouseup", "mousedown"]) {
        document.addEventListener(evtType, function(e) {
            document.getElementById("eventSequence").innerHTML += " " + e.type;
        });
    }

    var text = document.getElementById("text");

    var x = text.offsetParent.offsetLeft + text.offsetLeft + 4;
    var y = text.offsetParent.offsetTop + text.offsetTop + text.offsetHeight / 2;

    if (!window.eventSender)
        return;
    if (eventSender.gestureTwoFingerTap) {
        eventSender.gestureTwoFingerTap(x, y);
    } else {
        debug("gestureTwoFingerTap not implemented by this platform");
        return;
    }
}
</script>
</body>
</html>
